﻿/*
*athome 0.1
*Copyright (c) 2009 AtHome
*Date:2012-10-26
*
*/
/*---------------------------------------------------*/
(function ($) {
    /*---------------------------------------------------总宽度*/
    $.fn.outerWidth32 = function (option) {
        var JQself;
        var outerWidth = 0;
        if (option || option == 0) {
            return this.each(function () {
                JQself = $(this);
                var borderLeft = parseInt(JQself.css("border-left-width"));
                var borderRight = parseInt(JQself.css("border-right-width"));
                var paddingLeft = parseInt(JQself.css("padding-left"));
                var paddingRight = parseInt(JQself.css("padding-right"));
                outerWidth = parseInt(option) - (borderLeft + borderRight + paddingLeft + paddingRight);
                JQself.width(outerWidth);
            });
        } else {
            this.each(function () {
                JQself = $(this);
            });
            var borderLeft = parseInt(JQself.css("border-left-width"));
            var borderRight = parseInt(JQself.css("border-right-width"));
            var paddingLeft = parseInt(JQself.css("padding-left"));
            var paddingRight = parseInt(JQself.css("padding-right"));
            outerWidth = JQself.width() + borderLeft + borderRight + paddingLeft + paddingRight;
            return outerWidth;
        }


    }

    /*---------------------------------------------------总高度*/
    $.fn.outerHeight32 = function (option) {
        var JQself;
        var outerHeight = 0;
        if (option || option == 0) {
            return this.each(function () {
                JQself = $(this);
                var borderTop = parseInt(JQself.css("border-top-width"));
                var borderBottom = parseInt(JQself.css("border-bottom-width"));
                var paddingTop = parseInt(JQself.css("padding-top"));
                var paddingBottom = parseInt(JQself.css("padding-bottom"));
                outerHeight = parseInt(option) - (borderTop + borderBottom + paddingTop + paddingBottom);
                JQself.height(outerHeight);
            });
        } else {
            this.each(function () {
                JQself = $(this);
            });
            var borderTop = parseInt(JQself.css("border-top-width"));
            var borderBottom = parseInt(JQself.css("border-bottom-width"));
            var paddingTop = parseInt(JQself.css("padding-top"));
            var paddingBottom = parseInt(JQself.css("padding-bottom"));
            outerHeight = JQself.height() + borderTop + borderBottom + paddingTop + paddingBottom;
            return outerHeight;
        }
    }
})(jQuery);